﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title> new document </title>
    <META NAME="Generator" CONTENT="EditPlus,Microshaoft">
    <META NAME="Author" CONTENT="EditPlus,Microshaoft">
    <META NAME="Keywords" CONTENT="EditPlus,Microshaoft">
    <META NAME="Description" CONTENT="EditPlus,Microshaoft">
<script type="text/javascript" src="JS/jquery-1.6.js"></script>
<script type="text/javascript">
<!--
    var $j = jQuery.noConflict();
function FixTable(TableID, FixColumnNumber, width, height) {
/// <summary>
///     锁定表头和列
///     <para> sorex.cnblogs.com </para>
/// </summary>
/// <param name="TableID" type="String">
///     要锁定的Table的ID
/// </param>
/// <param name="FixColumnNumber" type="Number">
///     要锁定列的个数
/// </param>
/// <param name="width" type="Number">
///     显示的宽度
/// </param>
/// <param name="height" type="Number">
///     显示的高度
    /// </param>
    
    if ($j("#" + TableID + "_tableLayout").length != 0) {
        debugger;
$j("#" + TableID + "_tableLayout").before($j("#" + TableID));
$j("#" + TableID + "_tableLayout").empty();
}
else {
$j("#" + TableID).after("<div id='" + TableID + "_tableLayout' style='overflow:hidden;height:" + height + "px; width:" + width + "px;'></div>");
}
$j('<div id="' + TableID + '_tableFix"></div>'
+ '<div id="' + TableID + '_tableHead"></div>'
+ '<div id="' + TableID + '_tableColumn"></div>'
+ '<div id="' + TableID + '_tableData"></div>').appendTo("#" + TableID + "_tableLayout");
var oldtable = $j("#" + TableID);
var tableFixClone = oldtable.clone(true);
tableFixClone.attr("id", TableID + "_tableFixClone");
$j("#" + TableID + "_tableFix").append(tableFixClone);
var tableHeadClone = oldtable.clone(true);
tableHeadClone.attr("id", TableID + "_tableHeadClone");
$j("#" + TableID + "_tableHead").append(tableHeadClone);
var tableColumnClone = oldtable.clone(true);
tableColumnClone.attr("id", TableID + "_tableColumnClone");
$j("#" + TableID + "_tableColumn").append(tableColumnClone);
$j("#" + TableID + "_tableData").append(oldtable);
$j("#" + TableID + "_tableLayout table").each(function () {
$j(this).css("margin", "0");
});
var HeadHeight = $j("#" + TableID + "_tableHead thead").height();
HeadHeight += 2;
$j("#" + TableID + "_tableHead").css("height", HeadHeight);
$j("#" + TableID + "_tableFix").css("height", HeadHeight);
var ColumnsWidth = 0;
var ColumnsNumber = 0;
$j("#" + TableID + "_tableColumn tr:last td:lt(" + FixColumnNumber + ")").each(function () {
ColumnsWidth += $j(this).outerWidth(true);
ColumnsNumber++;
});
ColumnsWidth += 2;
if ($j.browser.msie) {
switch ($j.browser.version) {
case "7.0":
if (ColumnsNumber >= 3) ColumnsWidth--;
break;
case "8.0":
if (ColumnsNumber >= 2) ColumnsWidth--;
break;
}
}
$j("#" + TableID + "_tableColumn").css("width", ColumnsWidth);
$j("#" + TableID + "_tableFix").css("width", ColumnsWidth);
$j("#" + TableID + "_tableData").scroll(function () {
$j("#" + TableID + "_tableHead").scrollLeft($j("#" + TableID + "_tableData").scrollLeft());
$j("#" + TableID + "_tableColumn").scrollTop($j("#" + TableID + "_tableData").scrollTop());
});
$j("#" + TableID + "_tableFix").css({ "overflow": "hidden", "position": "relative", "z-index": "50", "background-color": "Silver" });
$j("#" + TableID + "_tableHead").css({ "overflow": "hidden", "width": width - 17, "position": "relative", "z-index": "45", "background-color": "Silver" });
$j("#" + TableID + "_tableColumn").css({ "overflow": "hidden", "height": height - 17, "position": "relative", "z-index": "40", "background-color": "Silver" });
$j("#" + TableID + "_tableData").css({ "overflow": "scroll", "width": width, "height": height, "position": "relative", "z-index": "35" });
if ($j("#" + TableID + "_tableHead").width() > $j("#" + TableID + "_tableFix table").width()) {
$j("#" + TableID + "_tableHead").css("width", $j("#" + TableID + "_tableFix table").width());
$j("#" + TableID + "_tableData").css("width", $j("#" + TableID + "_tableFix table").width() + 17);
}
if ($j("#" + TableID + "_tableColumn").height() > $j("#" + TableID + "_tableColumn table").height()) {
$j("#" + TableID + "_tableColumn").css("height", $j("#" + TableID + "_tableColumn table").height());
$j("#" + TableID + "_tableData").css("height", $j("#" + TableID + "_tableColumn table").height() + 17);
}
$j("#" + TableID + "_tableFix").offset($j("#" + TableID + "_tableLayout").offset());
$j("#" + TableID + "_tableHead").offset($j("#" + TableID + "_tableLayout").offset());
$j("#" + TableID + "_tableColumn").offset($j("#" + TableID + "_tableLayout").offset());
$j("#" + TableID + "_tableData").offset($j("#" + TableID + "_tableLayout").offset());
}
$j(document).ready(function() {
FixTable("MyTable", 1, 500, 300);
});
//-->
</script>
</head>
<body>
<table style="border-bottom-color: black; border-top-color: black; width: 960px; font-family: 微软雅黑; color: #000000; border-right-color: black; font-size: medium; border-left-color: black" id="MyTable" border="1" cellspacing="0" cellpadding="0">
<thead>

    <tr>
        <th style="text-align: center; width: 80px" rowspan="3">
            姓名
        </th>
        <th style="text-align: center; width: 80px" rowspan="3">
            班级
        </th>
        <th style="text-align: center" colspan="10">
            成绩
        </th>
    </tr>
    <tr>
        <th style="text-align: center" colspan="3">
            主科
        </th>
        <th style="text-align: center" colspan="3">
            文科
        </th>
        <th style="text-align: center" colspan="3">
            理科
        </th>
        <th style="text-align: center; width: 80px" rowspan="2">
            总分
        </th>
        </tr>
    <tr>
        <th style="text-align: center; width: 80px">
            语文
        </th>
        <th style="text-align: center; width: 80px">
            数学
        </th>
        <th style="text-align: center; width: 80px">
            英语
        </th>
        <th style="text-align: center; width: 80px">
            政治
        </th>
        <th style="text-align: center; width: 80px">
            历史
        </th>
        <th style="text-align: center; width: 80px">
            地理
        </th>
        <th style="text-align: center; width: 80px">
            物理
        </th>
        <th style="text-align: center; width: 80px">
            化学
        </th>
        <th style="text-align: center; width: 80px">
            生物
        </th>
    </tr>
</thead>
    <tbody>
    <!-- 数据行 -->
        <tr>
            <td>
                学生32
            </td>
            <td>
                班级1
            </td>
            <td>
                29
            </td>
            <td>
                25
            </td>
            <td>
                146
            </td>
            <td>
                28
            </td>
            <td>
                79
            </td>
            <td>
                73
            </td>
            <td>
                47
            </td>
            <td>
                8
            </td>
            <td>
                91
            </td>
            <td>
                526
            </td>
        </tr>
                <tr>
            <td>
                学生32
            </td>
            <td>
                班级1
            </td>
            <td>
                29
            </td>
            <td>
                25
            </td>
            <td>
                146
            </td>
            <td>
                28
            </td>
            <td>
                79
            </td>
            <td>
                73
            </td>
            <td>
                47
            </td>
            <td>
                8
            </td>
            <td>
                91
            </td>
            <td>
                526
            </td>
        </tr>
        <tr>
            <td>
                学生32
            </td>
            <td>
                班级1
            </td>
            <td>
                29
            </td>
            <td>
                25
            </td>
            <td>
                146
            </td>
            <td>
                28
            </td>
            <td>
                79
            </td>
            <td>
                73
            </td>
            <td>
                47
            </td>
            <td>
                8
            </td>
            <td>
                91
            </td>
            <td>
                526
            </td>
        </tr>
        <tr>
            <td>
                学生32
            </td>
            <td>
                班级1
            </td>
            <td>
                29
            </td>
            <td>
                25
            </td>
            <td>
                146
            </td>
            <td>
                28
            </td>
            <td>
                79
            </td>
            <td>
                73
            </td>
            <td>
                47
            </td>
            <td>
                8
            </td>
            <td>
                91
            </td>
            <td>
                526
            </td>
        </tr>
        <tr>
            <td>
                学生32
            </td>
            <td>
                班级1
            </td>
            <td>
                29
            </td>
            <td>
                25
            </td>
            <td>
                146
            </td>
            <td>
                28
            </td>
            <td>
                79
            </td>
            <td>
                73
            </td>
            <td>
                47
            </td>
            <td>
                8
            </td>
            <td>
                91
            </td>
            <td>
                526
            </td>
        </tr>
        <tr>
            <td>
                学生32
            </td>
            <td>
                班级1
            </td>
            <td>
                29
            </td>
            <td>
                25
            </td>
            <td>
                146
            </td>
            <td>
                28
            </td>
            <td>
                79
            </td>
            <td>
                73
            </td>
            <td>
                47
            </td>
            <td>
                8
            </td>
            <td>
                91
            </td>
            <td>
                526
            </td>
        </tr>
        <tr>
            <td>
                学生32
            </td>
            <td>
                班级1
            </td>
            <td>
                29
            </td>
            <td>
                25
            </td>
            <td>
                146
            </td>
            <td>
                28
            </td>
            <td>
                79
            </td>
            <td>
                73
            </td>
            <td>
                47
            </td>
            <td>
                8
            </td>
            <td>
                91
            </td>
            <td>
                526
            </td>
        </tr>
        <tr>
            <td>
                学生32
            </td>
            <td>
                班级1
            </td>
            <td>
                29
            </td>
            <td>
                25
            </td>
            <td>
                146
            </td>
            <td>
                28
            </td>
            <td>
                79
            </td>
            <td>
                73
            </td>
            <td>
                47
            </td>
            <td>
                8
            </td>
            <td>
                91
            </td>
            <td>
                526
            </td>
        </tr>
        <tr>
            <td>
                学生32
            </td>
            <td>
                班级1
            </td>
            <td>
                29
            </td>
            <td>
                25
            </td>
            <td>
                146
            </td>
            <td>
                28
            </td>
            <td>
                79
            </td>
            <td>
                73
            </td>
            <td>
                47
            </td>
            <td>
                8
            </td>
            <td>
                91
            </td>
            <td>
                526
            </td>
        </tr>
        <tr>
            <td>
                学生32
            </td>
            <td>
                班级1
            </td>
            <td>
                29
            </td>
            <td>
                25
            </td>
            <td>
                146
            </td>
            <td>
                28
            </td>
            <td>
                79
            </td>
            <td>
                73
            </td>
            <td>
                47
            </td>
            <td>
                8
            </td>
            <td>
                91
            </td>
            <td>
                526
            </td>
        </tr>
        <tr>
            <td>
                学生32
            </td>
            <td>
                班级1
            </td>
            <td>
                29
            </td>
            <td>
                25
            </td>
            <td>
                146
            </td>
            <td>
                28
            </td>
            <td>
                79
            </td>
            <td>
                73
            </td>
            <td>
                47
            </td>
            <td>
                8
            </td>
            <td>
                91
            </td>
            <td>
                526
            </td>
        </tr>
        <tr>
            <td>
                学生32
            </td>
            <td>
                班级1
            </td>
            <td>
                29
            </td>
            <td>
                25
            </td>
            <td>
                146
            </td>
            <td>
                28
            </td>
            <td>
                79
            </td>
            <td>
                73
            </td>
            <td>
                47
            </td>
            <td>
                8
            </td>
            <td>
                91
            </td>
            <td>
                526
            </td>
        </tr>
        <tr>
            <td>
                学生32
            </td>
            <td>
                班级1
            </td>
            <td>
                29
            </td>
            <td>
                25
            </td>
            <td>
                146
            </td>
            <td>
                28
            </td>
            <td>
                79
            </td>
            <td>
                73
            </td>
            <td>
                47
            </td>
            <td>
                8
            </td>
            <td>
                91
            </td>
            <td>
                526
            </td>
        </tr>
        <tr>
            <td>
                学生32
            </td>
            <td>
                班级1
            </td>
            <td>
                29
            </td>
            <td>
                25
            </td>
            <td>
                146
            </td>
            <td>
                28
            </td>
            <td>
                79
            </td>
            <td>
                73
            </td>
            <td>
                47
            </td>
            <td>
                8
            </td>
            <td>
                91
            </td>
            <td>
                526
            </td>
        </tr>
        <tr>
            <td>
                学生32
            </td>
            <td>
                班级1
            </td>
            <td>
                29
            </td>
            <td>
                25
            </td>
            <td>
                146
            </td>
            <td>
                28
            </td>
            <td>
                79
            </td>
            <td>
                73
            </td>
            <td>
                47
            </td>
            <td>
                8
            </td>
            <td>
                91
            </td>
            <td>
                526
            </td>
        </tr>
        <tr>
            <td>
                学生32
            </td>
            <td>
                班级1
            </td>
            <td>
                29
            </td>
            <td>
                25
            </td>
            <td>
                146
            </td>
            <td>
                28
            </td>
            <td>
                79
            </td>
            <td>
                73
            </td>
            <td>
                47
            </td>
            <td>
                8
            </td>
            <td>
                91
            </td>
            <td>
                526
            </td>
        </tr>

    </tbody>
    <tfoot>
        <tr><td colspan=2>合计</td>
            <td colspan=2>
                25
            </td>
            <td>
                28
            </td>
            <td>
                79
            </td>
            <td>
                73
            </td>
            <td>
                47
            </td>
            <td>
                8
            </td>
            <td>
                91
            </td>
            <td>
                526
            </td>
            <td>
                526
            </td>
            </tr>
    </tfoot>
</table>
</body>
</html>
